<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
use App\Models\Base;

class User extends Base
{
    use  Notifiable;
    use \Illuminate\Database\Eloquent\SoftDeletes;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'store_id',
        'department_id',
        'name',
        'avatar',
        'nickname',
        'sex',
        'phone',
        'balance',
        'id_card',
        'union_id',
        'app_open_id',
        'open_id',
        'type',
        'package_attr_permission_ids',
        'is_probation_period',
        'probation_period_start_time',
        'probation_period_end_time',
        'probation_period_salary'
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime'
    ];

    use SoftDeletes;

    public function store()
    {
        return $this->belongsTo(Store::class);
    }

    public function department()
    {
        return $this->belongsTo(Department::class);
    }

    public function position()
    {
        return $this->belongsTo(Position::class);
    }
}
